﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class admin_CourseDetails : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnSaveCourse_Click(object sender, EventArgs e)
    {
        ElearningDataContext context = new ElearningDataContext();
        Course newCourse = new Course();
        newCourse.courseName = txtCouseName.Text;
        newCourse.shortDescription = txtShortDescription.Text;
        newCourse.courseOutline = txtCourseOutline.Text;
        newCourse.learningObjectives = txtLearningObjectives.Text;
        newCourse.prerequisites = txtPrerequisites.Text;
        newCourse.location = txtLocation.Text;
        newCourse.price = Convert.ToDecimal(txtPrice.Text);
        newCourse.partsNr = Convert.ToInt32(txtPartsNr.Text);

        Video newVideo = new Video();
        newVideo.videoName = txtVideoName.Text;
        newVideo.url = txtVideoUrl.Text;
        newVideo.description = txtVideoDescription.Text;


        
        context.Courses.InsertOnSubmit(newCourse);
        context.Videos.InsertOnSubmit(newVideo);
        context.SubmitChanges();
        Response.Redirect("Courses.aspx");
    }
}